﻿using AttributeRouting.Web.Http;
//using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Water.Model;

namespace Water.RestService.Controllers
{
    public class ExplosionAccidentController : ApiController
    {
        private ExplosionAccident exa;
        private ExplosionAccidentQuery exaq;

        [POST("GetExplosionAccidents")]
        public IList<ExplosionAccidentQuery> PostGetExplosionAccidents(ExplosionAccidentCon eac)
        {
            exaq = new ExplosionAccidentQuery();
            return exaq.GetExplosionAccidents(eac);
        }
        /*
        [POST("GetExplosionAccidentsCount")]
        public int PostGetExplosionAccidentsCount(ExplosionAccident info)
        {
            var where = ExplosionAccidentWhere(info);
            int count = rep.LoadCount(where);
            return count;
        }
        */

        [POST("AddExplosionAccident")]
        public bool PostAddExplosionAccident(ExplosionAccident info)
        {
            info.MRNO = BuilderMrno.GetMrnoFortbl("Tbt_ExplosionAccident");
            exa = new ExplosionAccident();
            bool result = exa.AddExplosionAccident(info) > 0 ? true : false;
            return result;
        }

        /*
        [POST("EditExplosionAccident")]
        public bool PostEditExplosionAccident(ExplosionAccident info)
        {
            bool result = rep.Edit(info);
            return result;
        }

        [GET("DeleteExplosionAccident/{code}")]
        public bool GetDeleteExplosionAccident(string code)
        {
            bool result = rep.Delete(code);
            return result;
        }

        [GET("GetExplosionAccident/{code}")]
        public ExplosionAccident GetExplosionAccident(string code)
        {
            var result = rep.Get(code);
            return result;
        }
         * */
    }
}
